home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 June / EnigmA AMIGA RUN 19 (1997)(G.R. Edizioni)(IT)[!][issue 1997-06][EAR-CD III].iso / recent1 / apic1805.lha / APIC / examples / mouse.lst < prev    next >
File List  |  1997-05-10  |  24KB  |  593 lines

  1. #PIC V0.9.2 (c)1997 J.Petroglou    LIST FILE
  2. #file: data:aminetupp/PICSim/examples/mouse.src
  3. #date: Sat May 10 15:11:24 1997
  4. #pic : PIC16C54
  5.  
  6. ADDR CODE     SRCLINE SOURCECODE
  7.  
  8. 0000             000001 ;PC mouse adapter for Amiga computers
  9. 0000             000002 ;
  10. 0000             000003 ; use serial Pc mouse on Amiga Computers without Software driver !!
  11. 0000             000004 ;
  12. 0000             000005 ; 03.01.96
  13. 0000             000006 ;
  14. 0000             000007 ;This Program converts the microsoft and the mouse system format to amiga ones,
  15. 0000             000008 ;three mouse buttons are supported (mouse system).
  16. 0000             000009 ;Only hardware, it`s like an original Amiga mouse
  17. 0000             000010 ;The Xtal frequenzy is 11.0592 Mhz, the TXD line from mouse is with a 20K
  18. 0000             000011 ;resistor directly with the PIC 16C54 Port connected. Only three other components
  19. 0000             000012 ;are needed for the voltage conversion: ICL7660 (voltage converter from Harris 
  20. 0000             000013 ;semiconductor,INTERSIL) and two capacitors with 10µF. The PCB is about 3*4.5cm.
  21. 0000             000014 ;My PC mouse needs -5V on TXD,5V on RTS and ground. 
  22. 0000             000015 ;The adapter recognizes mouse protocoll changes automatic. I think it`s easy
  23. 0000             000016 ;to include the Logitech protokoll but I don`t know it.
  24. 0000             000017 ;
  25. 0000             000018 ; see our Amiga Pic Tools Home Page:
  26. 0000             000019 ;
  27. 0000             000020 ; http://linux.rz.fh-hannover.de/~duesterb/
  28. 0000             000021 ; (Pic Simulator, Pic Progger)
  29. 0000             000022 ;
  30. 0000             000023 ;Dirk Düsterberg, duesterb@unixserv.rz.fh-hannover.de
  31. 0000             000024 ;
  32. 0000             000025 ;Jahnstr.9
  33. 0000             000026 ;31860 Emmerthal
  34. 0000             000027 ;Germany
  35. 0000             000028 ;
  36. 0000             000029 ;
  37. 0000             000030 ;thanks to Joannis Petroglou, who made this with his wonderful Tools possibel!
  38. 0000             000031 
  39. 0000             000032 
  40. 0000             000033 
  41. 0000             000034 ; Microsoft is a registered trademark of Microsoft Corp.
  42. 0000             000035 ; Mouse Systems is  registered trademark of MSC Technologies, Inc.
  43. 0000             000036 ; Microchip is a registered trademark of Microchip Technology
  44. 0000             000037 ; Logitech is a registered trademark too
  45. 0000             000038 ; This source is copyrighted to Dirk Düsterberg, no trademark
  46. 0000             000039 
  47. 0000             000040 
  48. 0000             000041 
  49. 0000             000042 
  50. 0000             000043 
  51. 0000             000044 
  52. 0000             000045     list p=PIC16C54, r=hex, s=off
  53. 0000             000046 
  54. 01FF             000047     RESET    start
  55. 0000             000048 
  56. 0000             000049 
  57. 0000             000050     CBLOCK 08h
  58. 0000             000051       trycnt            ;synctrys, which format?
  59. 0000             000052       loopcnt            ;loop counter
  60. 0000             000053       bitcnt            ;bit counter
  61. 0000             000054       serbuf            ;serial buffer
  62. 0000             000055       RBbuf                ;Port buffer
  63. 0000             000056     ENDC
  64. 0000             000057 
  65. 0000             000058     CBLOCK    10h
  66. 0000             000059       byte0                ;first received byte
  67. 0000             000060       byte1                ;second received byte and byte 4 (mouse system)
  68. 0000             000061       byte2                ;third received byte and byte 5 (mouse system)
  69. 0000             000062     ENDC
  70. 0000             000063 
  71. 0000             000064 RA    =    5
  72. 0000             000065 RB    =    6
  73. 0000             000066 
  74. 0000             000067 
  75. 0000             000068 
  76. 0000             000069 #define    RXD    RA,1            ;RXD input, bit 1 from Port A
  77. 0000             000070 
  78. 0000             000071 #define    r_b    RBbuf,2            ;right mouse button
  79. 0000             000072 #define    m_b    RBbuf,4            ;middle mouse button
  80. 0000             000073 #define    l_b    RBbuf,6            ;left mouse button
  81. 0000             000074 
  82. 0000             000075 #define    H    RBbuf,0            ;Horizontal Pulses
  83. 0000             000076 #define    HQ    RBbuf,5            ;Horizontal Quadrature Pulses
  84. 0000             000077 #define    V    RBbuf,1            ;Vertical Pulses
  85. 0000             000078 #define    VQ    RBbuf,7            ;Vertical Quadrature Pulses
  86. 0000             000079 
  87. 0000             000080 
  88. 0000             000081 #define    c    03,0
  89. 0000             000082 #define    z    03,2
  90. 0000             000083 
  91. 0000             000084 
  92. 0000 0C00        000085 start    movlw    0
  93. 0001 0006        000086     tris    RB
  94. 0002             000087 
  95. 0002 0CFF        000088     movlw    0ffh
  96. 0003 0005        000089     tris    RA
  97. 0004             000090 
  98. 0004 006C        000091     clrf    RBbuf            ;make butoons unpressed
  99. 0005 00EC        000092     decf    RBbuf,f
  100. 0006             000093 
  101. 0006 020C        000094     movf    RBbuf,w            ;use Port buffer to prevent read from Port
  102. 0007 0026        000095     movwf    RB
  103. 0008             000096 
  104. 0008 0068        000097     clrf    trycnt,f
  105. 0009             000098 
  106. 0009             000099 
  107. 0009             000100 
  108. 0009             000101 
  109. 0009             000102 
  110. 0009             000103 
  111. 0009             000104 
  112. 0009             000105 
  113. 0009             000106 
  114. 0009             000107 
  115. 0009             000108 
  116. 0009             000109 ;this is the routine for the microsoft format (3 bytes with 2 buttons)
  117. 0009             000110 
  118. 0009             000111 
  119. 0009             000112 
  120. 0009 0068        000113 micro    clrf    trycnt,f
  121. 000A 0C04        000114 mic    movlw    .4
  122. 000B 0088        000115     subwf    trycnt,w
  123. 000C 0603        000116     btfsc    c
  124. 000D 0A48        000117     goto    mouse            ;more than 3 trys? jump!
  125. 000E             000118     
  126. 000E 0971        000119     call    rcb            ;receive the first byte
  127. 000F 02A8        000120     incf    trycnt,f
  128. 0010             000121     
  129. 0010 020B        000122     movf    serbuf,w
  130. 0011 0FC0        000123     xorlw    11000000b        ;invert bit 6 and 7 from working register
  131. 0012 0EC0        000124     andlw    11000000b        ;clr bit 0 to 5 (buttons and coord.)
  132. 0013 0743        000125     btfss    z            ;skip if w is zero
  133. 0014 0A0A        000126     goto    mic            ;if not zero -> no match
  134. 0015             000127 
  135. 0015 020B        000128     movf    serbuf,w        ;this is the first received byte
  136. 0016 0030        000129     movwf    byte0
  137. 0017             000130 
  138. 0017 058C        000131     bsf    m_b            ;middle button not supported
  139. 0018             000132 
  140. 0018 068B        000133     btfsc    serbuf,4        ;mov buttons
  141. 0019 044C        000134     bcf    r_b
  142. 001A 078B        000135     btfss    serbuf,4
  143. 001B 054C        000136     bsf    r_b
  144. 001C             000137 
  145. 001C 06AB        000138     btfsc    serbuf,5
  146. 001D 04CC        000139     bcf    l_b
  147. 001E 07AB        000140     btfss    serbuf,5
  148. 001F 05CC        000141     bsf    l_b
  149. 0020             000142 
  150. 0020 0971        000143     call    rcb            ;receive second byte
  151. 0021             000144 
  152. 0021             000145     
  153. 0021 0C80        000146     movlw    10000000b
  154. 0022 01AB        000147     xorwf    serbuf,f        ;invert bit 7 from buffer
  155. 0023 020B        000148     movf    serbuf,w
  156. 0024 0EC0        000149     andlw    11000000b        ;clr bit 0 to 5 (coord.)
  157. 0025 0743        000150     btfss    z                ;skip if w is zero
  158. 0026 0A48        000151     goto    mouse            ;if not zero -> no match -> mouse format
  159. 0027             000152         
  160. 0027             000153     
  161. 0027 0071        000154     clrf    byte1
  162. 0028             000155 
  163. 0028 0710        000156     btfss    byte0,0            ;mov x6 and x7 coord. to byte1
  164. 0029 04D1        000157     bcf    byte1,6
  165. 002A 0610        000158     btfsc    byte0,0
  166. 002B 05D1        000159     bsf    byte1,6
  167. 002C             000160 
  168. 002C             000161 
  169. 002C 0730        000162     btfss    byte0,1            ;mov x6 and x7 coord. to byte1
  170. 002D 04F1        000163     bcf    byte1,7
  171. 002E 0630        000164     btfsc    byte0,1
  172. 002F 05F1        000165     bsf    byte1,7
  173. 0030             000166 
  174. 0030             000167 
  175. 0030             000168 
  176. 0030 020B        000169     movf    serbuf,w        ;set rest of x coord.
  177. 0031 0131        000170     iorwf    byte1,f
  178. 0032             000171 
  179. 0032             000172 
  180. 0032             000173 
  181. 0032 0971        000174     call    rcb            ;receive third byte
  182. 0033             000175 
  183. 0033             000176 
  184. 0033 0C80        000177     movlw    10000000b
  185. 0034 01AB        000178     xorwf    serbuf,f        ;invert bit 7 from buffer
  186. 0035 020B        000179     movf    serbuf,w
  187. 0036 0EC0        000180     andlw    11000000b        ;clr bit 0 to 5 (coord.)
  188. 0037 0743        000181     btfss    z            ;skip if w is zero
  189. 0038 0A48        000182     goto    mouse            ;if not zero -> no match -> mouse format
  190. 0039             000183 
  191. 0039 0072        000184     clrf    byte2
  192. 003A             000185 
  193. 003A             000186 
  194. 003A             000187 
  195. 003A 0750        000188     btfss    byte0,2            ;mov y6 and y7 coord. to byte2
  196. 003B 04D2        000189     bcf    byte2,6
  197. 003C 0650        000190     btfsc    byte0,2
  198. 003D 05D2        000191     bsf    byte2,6
  199. 003E             000192 
  200. 003E             000193 
  201. 003E             000194 
  202. 003E 0770        000195     btfss    byte0,3            ;mov y6 and y7 coord. to byte2
  203. 003F 04F2        000196     bcf    byte2,7
  204. 0040 0670        000197     btfsc    byte0,3
  205. 0041 05F2        000198     bsf    byte2,7
  206. 0042             000199 
  207. 0042             000200 
  208. 0042             000201 
  209. 0042 020B        000202     movf    serbuf,w        ;set rest of y coord.
  210. 0043 0132        000203     iorwf    byte2,f
  211. 0044             000204 
  212. 0044 0272        000205     comf    byte2,f            ;fix microsoft to mouse protokoll
  213. 0045 02B2        000206     incf    byte2,f            ;(up and down exchanged)
  214. 0046             000207 
  215. 0046 0068        000208     clrf    trycnt
  216. 0047 0A09        000209     goto    micro
  217. 0048             000210 
  218. 0048             000211 
  219. 0048             000212 
  220. 0048             000213 ;this is the routine for the mouse system format (5 bytes with 3 buttons)
  221. 0048             000214 
  222. 0048             000215 
  223. 0048 0C06        000216 mouse    movlw    .6
  224. 0049 0088        000217     subwf    trycnt,w
  225. 004A 0603        000218     btfsc    c
  226. 004B 0A09        000219     goto    micro            ;more than 5 trys? jump micro!
  227. 004C             000220 
  228. 004C 0971        000221     call    rcb            ;get first of five bytes from serial mouse
  229. 004D             000222 
  230. 004D 02A8        000223     incf    trycnt,f        ;one more try
  231. 004E             000224 
  232. 004E             000225 ;test format #10000lmr (left, middle, right) 
  233. 004E             000226 
  234. 004E 020B        000227     movf    serbuf,w
  235. 004F 0F80        000228     xorlw    10000000b        ;invert bit 7 from working register
  236. 0050 0EF8        000229     andlw    11111000b        ;clr bit 0 to 2 (buttons)
  237. 0051 0743        000230     btfss    z            ;skip if w is zero
  238. 0052 0A48        000231     goto    mouse            ;if not zero -> no match
  239. 0053             000232     
  240. 0053 020B        000233     movf    serbuf,w
  241. 0054 0030        000234     movwf    byte0
  242. 0055             000235 
  243. 0055             000236 
  244. 0055             000237 
  245. 0055 0971        000238     call    rcb            ;byte1, X-Axis movement data
  246. 0056 020B        000239     movf    serbuf,w
  247. 0057 0031        000240     movwf    byte1
  248. 0058             000241 
  249. 0058 0971        000242     call    rcb            ;byte2, Y-Axis movement data
  250. 0059 020B        000243     movf    serbuf,w
  251. 005A 0032        000244     movwf    byte2
  252. 005B             000245     
  253. 005B 0971        000246     call    rcb            ;byte3, X-Axis movement data    
  254. 005C 020B        000247     movf    serbuf,w
  255. 005D 0031        000248     movwf    byte1
  256. 005E             000249 
  257. 005E 0971        000250     call    rcb            ;byte4, Y-Axis movement data
  258. 005F 020B        000251     movf    serbuf,w
  259. 0060 0032        000252     movwf    byte2
  260. 0061             000253 
  261. 0061             000254 
  262. 0061             000255 
  263. 0061 0710        000256     btfss    byte0,0            ;convert to Amiga
  264. 0062 044C        000257     bcf    r_b
  265. 0063 0610        000258     btfsc    byte0,0
  266. 0064 054C        000259     bsf    r_b
  267. 0065             000260 
  268. 0065             000261 
  269. 0065 0730        000262     btfss    byte0,1
  270. 0066 048C        000263     bcf    m_b
  271. 0067 0630        000264     btfsc    byte0,1
  272. 0068 058C        000265     bsf    m_b
  273. 0069             000266 
  274. 0069             000267 
  275. 0069 0750        000268     btfss    byte0,2
  276. 006A 04CC        000269     bcf    l_b
  277. 006B 0650        000270     btfsc    byte0,2
  278. 006C 05CC        000271     bsf    l_b
  279. 006D             000272 
  280. 006D             000273 
  281. 006D 020C        000274     movf    RBbuf,w
  282. 006E 0026        000275     movwf    RB            ;use Port buffer to prevent read from Port
  283. 006F             000276 
  284. 006F 0068        000277     clrf    trycnt            
  285. 0070             000278 
  286. 0070 0A48        000279     goto    mouse
  287. 0071             000280 
  288. 0071             000281 
  289. 0071             000282 
  290. 0071             000283 
  291. 0071             000284 
  292. 0071             000285 
  293. 0071             000286 
  294. 0071             000287 ;receive routine, receive 8bits
  295. 0071             000288 ;loop is done until byte is received
  296. 0071             000289 
  297. 0071             000290 
  298. 0071             000291 
  299. 0071             000292 
  300. 0071 0625        000293 rcb    btfsc    RXD
  301. 0072 0A74        000294     goto    rcshift            ;startbit ?
  302. 0073 0A71        000295     goto    rcb
  303. 0074             000296 
  304. 0074 0C08        000297 rcshift    movlw    .8
  305. 0075 002A        000298     movwf    bitcnt
  306. 0076             000299 
  307. 0076 0982        000300     call    whbit            ;wait half bit (middle bit position)
  308. 0077             000301 
  309. 0077 098E        000302 r_it    call    wbit            ;wait bit delay
  310. 0078             000303 
  311. 0078 0725        000304     btfss    RXD            ;move RXD into c
  312. 0079 0403        000305     bcf    c
  313. 007A 0625        000306     btfsc    RXD
  314. 007B 0503        000307     bsf    c
  315. 007C             000308 
  316. 007C 032B        000309     rrf    serbuf,f        ;rotate c in serbuf
  317. 007D 02EA        000310     decfsz    bitcnt
  318. 007E 0A77        000311     goto    r_it            ;decrement bit counter (8 bits)
  319. 007F 026B        000312     comf    serbuf            ;invert serbuf (RS232 -> TTL)
  320. 0080 0982        000313     call    whbit            ;wait a half bit to get out from data area
  321. 0081 0800        000314     retlw    0            ;back
  322. 0082             000315 
  323. 0082             000316 
  324. 0082             000317 
  325. 0082             000318 
  326. 0082             000319 
  327. 0082             000320 
  328. 0082             000321 
  329. 0082             000322 
  330. 0082             000323 ;wait routine for one and one half bit for 1200 baud
  331. 0082             000324 
  332. 0082             000325 
  333. 0082 0C7D        000326 whbit    movlw    .125
  334. 0083 0029        000327     movwf    loopcnt            ;1200
  335. 0084 0000        000328 do_hbit    nop
  336. 0085 0000        000329     nop
  337. 0086 0000        000330     nop
  338. 0087 0000        000331     nop
  339. 0088 0000        000332     nop
  340. 0089 0000        000333     nop
  341. 008A 0000        000334     nop
  342. 008B 02E9        000335     decfsz    loopcnt
  343. 008C 0A84        000336     goto    do_hbit
  344. 008D 0800        000337     retlw    0
  345. 008E             000338 
  346. 008E             000339 
  347. 008E             000340 
  348. 008E             000341 
  349. 008E             000342 
  350. 008E             000343 ;this routine is one bit long, it converts the axe counter to a quadrature
  351. 008E             000344 ;modulation, every change on V,VQ,H or HQ means a mouse move
  352. 008E             000345 
  353. 008E             000346 
  354. 008E 0C2D        000347 wbit    movlw    .45
  355. 008F 0029        000348     movwf    loopcnt            ;quad mod is done while bit waiting
  356. 0090             000349 
  357. 0090 0211        000350 x_axe    movf    byte1,w
  358. 0091 0643        000351     btfsc    z
  359. 0092 0AA8        000352     goto    x_axe0            ;byte1 = 0, nothing to do
  360. 0093 06F1        000353     btfsc    byte1,7
  361. 0094 0ABB        000354     goto    _right            ;jump if bit
  362. 0095 0000        000355     nop
  363. 0096 0000        000356     nop
  364. 0097 0000        000357     nop
  365. 0098 0000        000358     nop
  366. 0099 0000        000359     nop
  367. 009A 00F1        000360 left    decf    byte1,f            ;decrement byte 1
  368. 009B 060C        000361     btfsc    H
  369. 009C 0AA1        000362     goto    leftx1            ;jmp to x1 if H set
  370. 009D 06AC        000363     btfsc    HQ
  371. 009E 0AA6        000364     goto    left10
  372. 009F 050C        000365     bsf    H            ;set H if H and HQ clear
  373. 00A0 0AB6        000366     goto    lback1
  374. 00A1 06AC        000367 leftx1    btfsc    HQ            
  375. 00A2 040C        000368     bcf    H            ;clr H if H set and HQ set
  376. 00A3 07AC        000369     btfss    HQ
  377. 00A4 05AC        000370     bsf    HQ            ;set HQ if H set and HQ clear
  378. 00A5 0AB8        000371     goto    lback3
  379. 00A6 04AC        000372 left10    bcf    HQ            ;clear HQ if H clear and HQ set
  380. 00A7 0AB7        000373     goto    lback2
  381. 00A8 0000        000374 x_axe0    nop
  382. 00A9 0000        000375     nop
  383. 00AA 0000        000376     nop
  384. 00AB 0000        000377     nop
  385. 00AC 0000        000378     nop
  386. 00AD 0000        000379     nop
  387. 00AE 0000        000380     nop
  388. 00AF 0000        000381     nop
  389. 00B0 0000        000382     nop
  390. 00B1 0000        000383     nop
  391. 00B2 0000        000384     nop
  392. 00B3 0000        000385     nop
  393. 00B4 0000        000386     nop
  394. 00B5 0000        000387     nop
  395. 00B6 0000        000388 lback1    nop
  396. 00B7 0000        000389 lback2    nop
  397. 00B8 020C        000390 lback3    movf    RBbuf,w
  398. 00B9 0026        000391     movwf    RB            ;use Port buffer to prevent read from Port
  399. 00BA 0AD3        000392     goto    y_axe
  400. 00BB             000393 
  401. 00BB 0271        000394 _right    comf    byte1,f            ;negate byte1
  402. 00BC 02B1        000395     incf    byte1,f
  403. 00BD             000396 
  404. 00BD 0000        000397     nop
  405. 00BE 0000        000398     nop
  406. 00BF             000399 
  407. 00BF 00F1        000400 right    decf    byte1,f
  408. 00C0 06AC        000401     btfsc    HQ
  409. 00C1 0AC6        000402     goto    right1x            ;jmp to 1x if HQ set
  410. 00C2 060C        000403     btfsc    H
  411. 00C3 0ACB        000404     goto    right01
  412. 00C4 05AC        000405     bsf    HQ            ;set HQ if H and HQ clear
  413. 00C5 0ACD        000406     goto    rback1
  414. 00C6 060C        000407 right1x    btfsc    H            
  415. 00C7 04AC        000408     bcf    HQ            ;clrb H if H and HQ set
  416. 00C8 070C        000409     btfss    H
  417. 00C9 050C        000410     bsf    H            ;setb H if H clear and HQ set
  418. 00CA 0ACF        000411     goto    rback3
  419. 00CB 040C        000412 right01    bcf    H            ;clr H if HQ clear and H set
  420. 00CC 0ACE        000413     goto    rback2
  421. 00CD             000414 
  422. 00CD 0000        000415 rback1    nop
  423. 00CE 0000        000416 rback2    nop
  424. 00CF 020C        000417 rback3    movf    RBbuf,w
  425. 00D0 0026        000418     movwf    RB            ;use Port buffer to prevent read from Port
  426. 00D1 0271        000419     comf    byte1,f
  427. 00D2 02B1        000420     incf    byte1,f
  428. 00D3             000421 
  429. 00D3             000422     
  430. 00D3             000423 
  431. 00D3             000424 
  432. 00D3 0212        000425 y_axe    movf    byte2,w
  433. 00D4 0643        000426     btfsc    z
  434. 00D5 0AEB        000427     goto    y_axe0            ;byte2 = 0, nothing to do
  435. 00D6 06F2        000428     btfsc    byte2,7
  436. 00D7 0AFE        000429     goto    _up            ;jump if bit
  437. 00D8 0000        000430     nop
  438. 00D9 0000        000431     nop
  439. 00DA 0000        000432     nop
  440. 00DB 0000        000433     nop
  441. 00DC 0000        000434     nop
  442. 00DD 00F2        000435 down    decf    byte2,f
  443. 00DE 06EC        000436     btfsc    VQ
  444. 00DF 0AE4        000437     goto    down1x            ;jmp to 1x if VQ set
  445. 00E0 062C        000438     btfsc    V
  446. 00E1 0AE9        000439     goto    down01
  447. 00E2 05EC        000440     bsf    VQ            ;set VQ if V and VQ clear
  448. 00E3 0AF9        000441     goto    dback1
  449. 00E4 062C        000442 down1x    btfsc    V            
  450. 00E5 04EC        000443     bcf    VQ            ;clrb V if V and VQ set
  451. 00E6 072C        000444     btfss    V
  452. 00E7 052C        000445     bsf    V            ;setb V if V clear and VQ set
  453. 00E8 0AFB        000446     goto    dback3
  454. 00E9 042C        000447 down01    bcf    V            ;clr V if VQ clear and V set
  455. 00EA 0AFA        000448     goto    dback2
  456. 00EB 0000        000449 y_axe0    nop
  457. 00EC 0000        000450     nop
  458. 00ED 0000        000451     nop
  459. 00EE 0000        000452     nop
  460. 00EF 0000        000453     nop
  461. 00F0 0000        000454     nop
  462. 00F1 0000        000455     nop
  463. 00F2 0000        000456     nop
  464. 00F3 0000        000457     nop
  465. 00F4 0000        000458     nop
  466. 00F5 0000        000459     nop
  467. 00F6 0000        000460     nop
  468. 00F7 0000        000461     nop
  469. 00F8 0000        000462     nop
  470. 00F9 0000        000463 dback1    nop
  471. 00FA 0000        000464 dback2    nop
  472. 00FB 020C        000465 dback3    movf    RBbuf,w
  473. 00FC 0026        000466     movwf    RB            ;use Port buffer to prevent read from Port
  474. 00FD 0B16        000467     goto    done
  475. 00FE             000468 
  476. 00FE 0272        000469 _up    comf    byte2,f
  477. 00FF 02B2        000470     incf    byte2,f
  478. 0100 0000        000471     nop
  479. 0101 0000        000472     nop
  480. 0102             000473 
  481. 0102 00F2        000474 up    decf    byte2,f
  482. 0103 062C        000475     btfsc    V
  483. 0104 0B09        000476     goto    up_x1            ;jmp to x1 if V set
  484. 0105 06EC        000477     btfsc    VQ
  485. 0106 0B0E        000478     goto    up_10
  486. 0107 052C        000479     bsf    V            ;set V if V and VQ clear
  487. 0108 0B10        000480     goto    uback1
  488. 0109 06EC        000481 up_x1    btfsc    VQ            
  489. 010A 042C        000482     bcf    V            ;clr V if V set and VQ set
  490. 010B 07EC        000483     btfss    VQ
  491. 010C 05EC        000484     bsf    VQ            ;set VQ if V set and VQ clear
  492. 010D 0B12        000485     goto    uback3
  493. 010E 04EC        000486 up_10    bcf    VQ            ;clear VQ if V clear and VQ set
  494. 010F 0B11        000487     goto    uback2
  495. 0110 0000        000488 uback1    nop
  496. 0111 0000        000489 uback2    nop
  497. 0112 020C        000490 uback3    movf    RBbuf,w
  498. 0113 0026        000491     movwf    RB            ;use Port buffer to prevent read from Port
  499. 0114 0272        000492     comf    byte2,f
  500. 0115 02B2        000493     incf    byte2,f
  501. 0116             000494     
  502. 0116             000495     
  503. 0116             000496 
  504. 0116 02E9        000497 done    decfsz    loopcnt
  505. 0117 0A90        000498     goto    x_axe
  506. 0118 0800        000499     retlw    0    
  507.  
  508.  
  509. Used Symbols
  510. -----------------------------------------
  511. trycnt                           00000008
  512. loopcnt                          00000009
  513. bitcnt                           0000000A
  514. serbuf                           0000000B
  515. RBbuf                            0000000C
  516. byte0                            00000010
  517. byte1                            00000011
  518. byte2                            00000012
  519. RA                               00000005
  520. RB                               00000006
  521. start                            00000000
  522. micro                            00000009
  523. mic                              0000000A
  524. mouse                            00000048
  525. rcb                              00000071
  526. rcshift                          00000074
  527. r_it                             00000077
  528. whbit                            00000082
  529. do_hbit                          00000084
  530. wbit                             0000008E
  531. x_axe                            00000090
  532. left                             0000009A
  533. leftx1                           000000A1
  534. left10                           000000A6
  535. x_axe0                           000000A8
  536. lback1                           000000B6
  537. lback2                           000000B7
  538. lback3                           000000B8
  539. _right                           000000BB
  540. right                            000000BF
  541. right1x                          000000C6
  542. right01                          000000CB
  543. rback1                           000000CD
  544. rback2                           000000CE
  545. rback3                           000000CF
  546. y_axe                            000000D3
  547. down                             000000DD
  548. down1x                           000000E4
  549. down01                           000000E9
  550. y_axe0                           000000EB
  551. dback1                           000000F9
  552. dback2                           000000FA
  553. dback3                           000000FB
  554. _up                              000000FE
  555. up                               00000102
  556. up_x1                            00000109
  557. up_10                            0000010E
  558. uback1                           00000110
  559. uback2                           00000111
  560. uback3                           00000112
  561. done                             00000116
  562.  
  563.  
  564. Used Defines
  565. -----------------------------------------
  566. RXD                              RA,1 
  567. r_b                              RBbuf,2 
  568. m_b                              RBbuf,4 
  569. l_b                              RBbuf,6 
  570. H                                RBbuf,0 
  571. HQ                               RBbuf,5 
  572. V                                RBbuf,1 
  573. VQ                               RBbuf,7 
  574. c                                03,0 
  575. z                                03,2 
  576.  
  577.  
  578. PROGRAM MEMORY USAGE TABLE:    '-' = not used  'X' = used
  579.  
  580. 0000 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  581. 0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  582. 0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  583. 00C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX
  584. 0100 : XXXXXXXXXXXXXXXX XXXXXXXXX------- ---------------- ----------------
  585. 0140 : ---------------- ---------------- ---------------- ----------------
  586. 0180 : ---------------- ---------------- ---------------- ----------------
  587. 01C0 : ---------------- ---------------- ---------------- ----------------
  588.  
  589. Program Memory Words Used:  0281
  590. Program Memory Words Free:  0231
  591.  
  592. Errors: 0
  593.